import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login'
import User from "../components/user/User";
import Echarts from "../components/echarts/Echarts";
import AddMusic from "../components/music/AddMusic";
import Longing from "../components/Longing";
import MusicList from "../components/music/MusicList";
import getSinger from "../components/music/getSinger";
import Audio from "../components/audio/Audio";
import Audio2 from "../components/audio/Audio2";

Vue.use(Router)


// vue-router 报错、:Avoided redundant navigation to current location 错误、路由重复
// 这个报错是重复路由引起的
// 只需在注册路由组建后使用下方重写路由就可以
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}




export default new Router({
  routes: [
    {path: '/', name: 'Login', component: Login,meta:{doNotshowCommonHeader:true}},
    {path: '/user', name: 'User', component: User},
    {path: '/echarts', name: 'Echarts', component: Echarts},
    {path: '/addMusic', name: 'AddMusic', component: AddMusic},
    {path: '/musicList', name: 'MusicList', component: MusicList},
    {path: '/getSinger', name: 'getSinger', component: getSinger},
    {path: '/audio', name: 'Audio', component: Audio},
    {path: '/audio2', name: 'Audio2', component: Audio2},
    {path: '/logining', name: 'Longing', component: Longing,meta:{doNotshowCommonHeader:true}}
  ]
})
